home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / boosters.arc / SPACE.PAS < prev    next >
Pascal/Delphi Source File  |  1985-11-13  |  570b  |  22 lines

  1. { -------------------------
  2.   SPACE normalizes a string
  3.   ------------------------- }
  4. Function Space ( S : AnyString ) : AnyString;
  5. var
  6.    Ts : AnyString;
  7.    CurrentWord, NumberOfWords : integer;
  8. begin
  9.    Ts := '';
  10.    NumberOfWords := words(S);
  11.    if NumberOfWords > 0 then
  12.    begin
  13.       for CurrentWord := 1 to NumberOfWords do
  14.       begin
  15.          if CurrentWord <> NumberOfWords then
  16.             Ts := Ts + word ( S, CurrentWord ) + ' '
  17.          else
  18.             Ts := Ts + word ( S,CurrentWord);
  19.       end;
  20.    end;
  21.   Space := Ts;
  22. end {Space} ;